#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 5010;
int a[N];
int n, m, p;
int find(int x)
{
    return a[x] == x ? x : a[x] = find(a[x]);
}
int main()
{
    cin >> n >> m >> p;
    for (int i = 1; i <= n; i++)
    {
        a[i] = i;
    }
    while (m--)
    {
        int x, y;
        cin >> x >> y;
        int u = find(x);
        int i = find(y);
        a[i] = u;
    }
    while (p--)
    {
        int q, w;
        cin >> q >> w;
        if (find(q) == find(w))
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
    return 0;
}